import { rcaNumberFormat } from './common.js'
import { dateFormat } from '@/util/date'
import { commonTableOption } from './common.js'
export const startDate = dateFormat(new Date(), 'yyyy-MM-') + '01';
export const endDate = dateFormat(new Date(), 'yyyy-MM-dd');

export const tableOption = {
  ...commonTableOption,
  selection: false,
  menu: true,
  delBtn: false,
  editBtn: false,
  column: [
    {
      type: 'date',
      label: '日期',
      prop: 'tradeDate',
      searchSpan: 12,
      searchRange: true,
      search: true,
      searchValue: [startDate, endDate],      // 这是我获取的默认的显示日期，我这里是['2020-08-04', '2020-09-22']
      format: 'yyyy-MM-dd',                  // 这是组件展示的日期格式
      valueFormat: 'yyyy-MM-dd',
    }, {
      type: 'select',
      label: '线路',
      prop: 'lineCode',
      search: true,
      props: {
        label: 'name',
        value: 'code'
      },
      dicUrl: '/support/swparamline/dictsecondnamecase',
    }, {
      type: 'select',
      label: '确认状态',
      prop: 'confirmStatus',
      search: false,
      hide: true,
      dicUrl: '/admin/dict/type/adjust_confirm',
    }, {
      type: 'input',
      label: '确认人',
      hide: true,
      prop: 'confirmName',
    }, {
      type: 'date',
      label: '创建时间',
      prop: 'createTime',
      format: 'yyyy-MM-dd HH:mm:ss',                  // 这是组件展示的日期格式
      valueFormat: 'yyyy-MM-dd HH:mm:ss',
    }, {
      type: 'date',
      label: '更新时间',
      prop: 'updateTime',
      format: 'yyyy-MM-dd HH:mm:ss',                  // 这是组件展示的日期格式
      valueFormat: 'yyyy-MM-dd HH:mm:ss',
    }]
}
export const exportDateOption = {//按日期导出
  emptyBtn: false,
  submitBtn: false,
  column: [{
    "type": "date",
    "label": "开始日期",
    "prop": "startDate",
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    rules: [
      {
        required: true,
        message: '请选择开始日期',
        trigger: 'blur'
      }
    ]
  }, {
    "type": "date",
    "label": "结束日期",
    "prop": "endDate",
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    rules: [
      {
        required: true,
        message: '请选择结束日期',
        trigger: 'blur'
      }
    ]
  },{
    type: "select",
    label: "线路",
    prop: "lineCodes",
    cascaderItem: ['stationCode'],
    props: {
      label: 'name',
      value: 'code'
    },
    filterable: true,
    dicUrl: "/support/swparamline/dictsecondnamecase",
    multiple: true,//多选控制
    rules: [
      {
        required: true,
        message: "请选择线路"
      }
    ],
  }]
}

export const exportStationOption = {//按车站导出
  emptyBtn: false,
  submitBtn: false,
  column: [{
    "type": "date",
    "label": "开始日期",
    "prop": "startDate",
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    rules: [
      {
        required: true,
        message: '请选择开始日期',
        trigger: 'blur'
      }
    ]
  }, {
    "type": "date",
    "label": "结束日期",
    "prop": "endDate",
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    rules: [
      {
        required: true,
        message: '请选择结束日期',
        trigger: 'blur'
      }
    ]
  },{
    type: "select",
    label: "线路",
    prop: "lineCodes",
    //cascaderItem: ['stationCode'],
    props: {
      label: 'name',
      value: 'code'
    },
    filterable: true,
    dicUrl: "/support/swparamline/dictsecondnamecase",
    multiple: true,//多选控制
    rules: [
      {
        required: true,
        message: "请选择线路"
      }
    ],
  }]
}

export const exportAffairsOption = {//按财务导出
  emptyBtn: false,
  submitBtn: false,
  column: [{
    "type": "date",
    "label": "开始日期",
    "prop": "startDate",
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    rules: [
      {
        required: true,
        message: '请选择开始日期',
        trigger: 'blur'
      }
    ]
  }, {
    "type": "date",
    "label": "结束日期",
    "prop": "endDate",
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    rules: [
      {
        required: true,
        message: '请选择结束日期',
        trigger: 'blur'
      }
    ]
  },{
    type: "select",
    label: "线路",
    prop: "lineCodes",
    cascaderItem: ['stationCode'],
    props: {
      label: 'name',
      value: 'code'
    },
    filterable: true,
    dicUrl: "/support/swparamline/dictsecondnamecase",
    multiple: true,//多选控制
    rules: [
      {
        required: true,
        message: "请选择线路"
      }
    ],
  }]
}

export const confrmOption = {//批量确认
  emptyBtn: false,
  submitBtn: false,
  column: [{
    "type": "date",
    "label": "开始日期",
    "prop": "startDate",
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    rules: [
      {
        required: true,
        message: '请选择开始日期',
        trigger: 'blur'
      }
    ]
  }, {
    "type": "date",
    "label": "结束日期",
    "prop": "endDate",
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    rules: [
      {
        required: true,
        message: '请选择结束日期',
        trigger: 'blur'
      }
    ]
  },{
    type: "select",
    label: "线路",
    prop: "lineCodes",
    props: {
      label: 'name',
      value: 'code'
    },
    filterable: true,
    dicUrl: "/support/swparamline/dictsecondname",
    multiple: true,
    rules: [
      {
        required: true,
        message: "请选择一条或多条线路"
      }
    ],
  }]
}